import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const routes = [
  {
    path: '/',
    name: 'home',
    redirect: '/index',
    component: HomeView,
    children:[
      {path: '/user/profile', component: () => import(  '../views/user/ProfileView.vue')},
      {path: 'index', component: () => import(  '../views/index/IndexView.vue')},
      {path: 'order', component: () => import(  '../views/order/OrderView.vue')},
    ]
  },
  {path: '/auth/login', component: () => import(  '../views/auth/LoginView.vue')},
  {
    path: '/shop/detail/:id',
    name: 'ShopDetail',
    component: () => import('../views/shop/DetailView.vue'),
    props: true
  },
  {
    path: '/shop/book/:roomId',
    name: 'BookingPage',
    component: () => import('../views/shop/BookingView.vue'),
    props: true
  },
  {
    path: '/test',
    name: 'test',
    component: () => import('../views/testView.vue')
  }

]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
